<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <input type="file"  name="" id="input" />
  <script>
    let arr = [1,1,2,2,3,3,3,4,4]
    a(arr);
    function a(arr) {
      let obj = {}
      let num = 1;
      arr.forEach((item,index) =>{
        
        
        if (item == arr[index+1]) {
          num++;
          obj[item] = num;
        }else{
          num = 1;
        }
        
         
      })
      console.log(obj);
    }
    const onchange = (e)=>{
      console.log(11);
    }
    var inputEle = document.querySelector('#input')
    inputEle.addEventListener('change', handleInput)
    function handleInput(e) {
      console.log(e);
      // 处理事件代码
    }
  </script>
</body>
</html>